load("@rules_proto_grpc//:defs.bzl", "proto_plugin")

proto_plugin(
    name = "plugin",
    empty_template = "empty.template",
    exclusions = [
        "google/api",
        "google/protobuf",
    ],
    options = ["paths=source_relative"],
    outputs = ["{protopath}.pb.gw.go"],
    separate_options_flag = True,
    tool = select({
        "@bazel_tools//src/conditions:darwin_arm64": "@grpc_gateway_plugin_darwin_arm64//file",
        "@bazel_tools//src/conditions:darwin_x86_64": "@grpc_gateway_plugin_darwin_x86_64//file",
        "@bazel_tools//src/conditions:linux_aarch64": "@grpc_gateway_plugin_linux_arm64//file",
        "@bazel_tools//src/conditions:linux_x86_64": "@grpc_gateway_plugin_linux_x86_64//file",
        "@bazel_tools//src/conditions:windows_arm64": "@grpc_gateway_plugin_windows_arm64//file",
        "@bazel_tools//src/conditions:windows_x64": "@grpc_gateway_plugin_windows_x86_64//file",
    }),
    visibility = ["//visibility:public"],
)

proto_plugin(
    name = "openapiv2_plugin",
    exclusions = [
        "google/api",
        "google/protobuf",
    ],
    outputs = ["{protopath}.swagger.json"],
    quirks = [
        "QUIRK_DIRECT_MODE",
    ],
    separate_options_flag = True,
    tool = select({
        "@bazel_tools//src/conditions:darwin_arm64": "@openapiv2_plugin_darwin_arm64//file",
        "@bazel_tools//src/conditions:darwin_x86_64": "@openapiv2_plugin_darwin_x86_64//file",
        "@bazel_tools//src/conditions:linux_aarch64": "@openapiv2_plugin_linux_arm64//file",
        "@bazel_tools//src/conditions:linux_x86_64": "@openapiv2_plugin_linux_x86_64//file",
        "@bazel_tools//src/conditions:windows_arm64": "@openapiv2_plugin_windows_arm64//file",
        "@bazel_tools//src/conditions:windows_x64": "@openapiv2_plugin_windows_x86_64//file",
    }),
    visibility = ["//visibility:public"],
)
